﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TinkleDao
{
    public static class ConexaoBD
    {
        public static string GetConnectionStrings()
        {
            return GetConnectionStrings(null);
        }

        public static string GetConnectionStrings(string _NomeConexao)
        {
            if (string.IsNullOrEmpty(_NomeConexao))
            {
                if (System.Web.HttpContext.Current.Session != null)
                {
                    if (System.Web.HttpContext.Current.Session["_NomeConexao"] != null)
                    {
                        _NomeConexao = System.Web.HttpContext.Current.Session["_NomeConexao"].ToString();
                    }
                    else
                    {
                        _NomeConexao = System.Configuration.ConfigurationManager.ConnectionStrings["tinkleEntities1"].ToString();
                    }
                }
                else
                {
                    _NomeConexao = System.Configuration.ConfigurationManager.ConnectionStrings["tinkleEntities1"].ToString();
                }
            }
            return _NomeConexao;
        }
    }
}
